package com.lg.atp.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lg.atp.dao.AppInfoDao;
import com.lg.atp.entity.TblAppInfo;
import com.lg.atp.service.IAppInfoService;

@Service("iAppInfoService")
public class AppInfoServiceImpl implements IAppInfoService{

	@Autowired
	private AppInfoDao appInfoDao;
	
	
	@Override
	public List<TblAppInfo> selectEditedApp() {
		return appInfoDao.selectEditedApp();
	}


	@Override
	public PageInfo<TblAppInfo> selectAllApp(TblAppInfo app,Integer pageIndex, Integer pageSize) {
		PageHelper.startPage(pageIndex, pageSize);
		List<TblAppInfo> applist = appInfoDao.selectAllApp(app);
		PageInfo<TblAppInfo> list = new PageInfo<TblAppInfo>(applist);
		return list;
	}


	@Override
	public TblAppInfo selectAppById(Long id) {
		return appInfoDao.selectAppById(id);
	}


	@Override
	public void saveApp(TblAppInfo app) {
		appInfoDao.saveApp(app);
	}


	@Override
	public void updateApp(TblAppInfo app) {
		appInfoDao.updateApp(app);
	}


	@Override
	public void deleteApps(String ids) {
		List<Long> list = new ArrayList<Long>();
		for(String id:ids.split(",")){
			list.add(Long.valueOf(id));
		}
		appInfoDao.deleteApps(list);
	}

}
